package com.rectcircle.scalatrateset.controller

import com.rectcircle.scalatrateset.util.Logging
import org.scalatra._
import org.scalatra.scalate.ScalateSupport

trait ScalatratestStack extends ScalatraServlet with ScalateSupport with Logging {
	
	//override def isScalateErrorPageEnabled = false
	
  notFound {
    // remove content type in case it was set through an action
	  println(contentType)
    contentType = null
//	  println("执行notFound函数")
//    // Try to render a ScalateTemplate if no route matched
//    findTemplate(requestPath) map { path =>
//      contentType = "text/html"
//		println("执行notFound函数findTemplate部分")
//      	//layoutTemplate(path)
//		layoutTemplate("/WEB-INF/templates/views/notfound.ssp")
//		//ssp("notfound","layout"->"","path"->path)
//    } orElse serveStaticResource() getOrElse resourceNotFound()
	  serveStaticResource() getOrElse {
		  contentType = "text/html;charset=UTF-8"
		  ssp("notfound","layout"->"","path"->requestPath)
	  }
	  
  }

}
